/* Copyright (C) 2010 Fredrique Samuels, fredriquesamuels@gmail.com 

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef TRI_EXT_POPUP_H_
#define TRI_EXT_POPUP_H_

#include "panel.h"

namespace tri{
namespace ui{

class extPopup : public extPanel
{
public:
	extPopup();
	virtual ~extPopup();
	
	//virtual methods
	virtual void display();
	virtual void update();
	
	//public setter methods
	void setHideOnFocusLost(bool b);

	//public methods
	void hide();
	void show();
	
	template<class desttype>
	inline void connectShow(int slot, desttype* object,void (desttype::*pmemfunc)(std::string)){
		if (object != NULL && pmemfunc != NULL){
			ON_SHOW_WT.connect(object, pmemfunc);
		}
	}
	
	template<class desttype>
	inline void connectShow(int slot, desttype* object,void (desttype::*pmemfunc)()){
		if (object != NULL && pmemfunc != NULL){
			ON_SHOW.connect(object, pmemfunc);
		}
	}
	
	template<class desttype>
	inline void connectHide(int slot, desttype* object,void (desttype::*pmemfunc)(std::string)){
		if (object != NULL && pmemfunc != NULL){
			ON_HIDE_WT.connect(object, pmemfunc);
		}
	}
	
	template<class desttype>
	inline void connectHide(int slot, desttype* object,void (desttype::*pmemfunc)()){
		if (object != NULL && pmemfunc != NULL){
			ON_HIDE.connect(object, pmemfunc);
		}
	}
	
private:
	
	//event signals
	sigslot::signal1<extPopup*,sigslot::multi_threaded_local> ON_SHOW;
	sigslot::signal1<extPopup*,sigslot::multi_threaded_local> ON_HIDE;
	
	sigslot::signal1<extPopup*,sigslot::multi_threaded_local> ON_SHOW_WT;
	sigslot::signal1<extPopup*,sigslot::multi_threaded_local> ON_HIDE_WT;
	
	//attributes
	bool mHideOnFocusLost;
};

}
}
#endif /*POPUP_H_*/
